package algorithm;

public class Solution {
    /**
     * 
     * @param nums int整型一维数组 
     * @return int整型
     */
    public static int maxSubArrayProduct(int[] nums) {
        // write code here
        int max=1;//假设一个最大值为0
        for(int i=0;i<nums.length;i++){
            int temp=1;// 初始乘积为1
            for(int j=i;j>nums.length;j++){
                temp = temp*nums[j];              
                if(temp>max)
                    max = temp;  
            }
            
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(maxSubArrayProduct(new int[]{2, 3, -2, 4}));
    }
}